import {
  View,
  Text,
  SafeAreaView,
  StyleSheet,
  ScrollView,
  Image,
  TouchableOpacity,
} from 'react-native';
import React from 'react';
import Ionicons from 'react-native-vector-icons/Ionicons';
export default function UserStack({navigation}) {
  return (
    <SafeAreaView style={[styles.container]}>
      <ScrollView>
        <View style={[styles.avatar]}>
          <Image
            source={{uri: 'https://reactnative.dev/img/tiny_logo.png'}}
            style={{
              width: 80,
              height: 80,
              marginVertical: 10,
              borderRadius: 40,
            }}
          />
        </View>
        <TouchableOpacity onPress={() => navigation.navigate('About')}>
          <View style={[styles.listItem]}>
            <View style={{flexDirection: 'row', alignItems: 'flex-end'}}>
              <Ionicons
                name="information-circle-outline"
                size={20}
                color={'#2d3'}
              />
              <Text style={{marginLeft: 3, fontSize: 18}}>关于</Text>
            </View>
            <Ionicons name="chevron-forward-outline" size={20} />
          </View>
        </TouchableOpacity>
        <TouchableOpacity onPress={() => console.log()}>
          <View style={[styles.listItem]}>
            <View style={{flexDirection: 'row', alignItems: 'flex-end'}}>
              <Ionicons name="settings-outline" size={20} color={'#22d'} />
              <Text style={{marginLeft: 3, fontSize: 18}}>设置</Text>
            </View>
            <Ionicons name="chevron-forward-outline" size={20} />
          </View>
        </TouchableOpacity>
        <TouchableOpacity onPress={() => navigation.navigate('Login')}>
          <View style={[styles.listItem]}>
            <View style={{flexDirection: 'row', alignItems: 'flex-end'}}>
              <Ionicons name="logo-reddit" size={20} color={'#2d3'} />
              <Text style={{marginLeft: 3, fontSize: 18}}>登录</Text>
            </View>
            <Ionicons name="chevron-forward-outline" size={20} />
          </View>
        </TouchableOpacity>
        <TouchableOpacity onPress={() => console.log()}>
          <View style={[styles.listItem]}>
            <View style={{flexDirection: 'row', alignItems: 'flex-end'}}>
              <Ionicons name="exit-outline" size={20} color={'#2d3'} />
              <Text style={{marginLeft: 3, fontSize: 18}}>退出</Text>
            </View>
            <Ionicons name="chevron-forward-outline" size={20} />
          </View>
        </TouchableOpacity>
      </ScrollView>
    </SafeAreaView>
  );
}

const styles = StyleSheet.create({
  container: {
    justifyContent: 'flex-start',
  },
  avatar: {
    flexDirection: 'row',
    borderBottomWidth: 1,
    justifyContent: 'center',
    borderBottomColor: '#ddd',
  },
  listItem: {
    flexDirection: 'row',
    alignItems: 'center',
    justifyContent: 'space-between',
    borderBottomWidth: 1,
    height: 50,
    paddingHorizontal: 20,
    borderBottomColor: '#ddd',
  },
});
